CaseExpression.Searched case

Selects one from a number of alternate values

Format

CASE [ WHEN bool-condition THEN expression ]* [ ELSE expression ] END

Remarks

The searched case condition consists of one or more WHEN ... END clauses with a last resort ELSE clause. Each WHEN condition is evaluated in the order as written. As soon as one is found for which the bool-condition returns true, the value of the corresponding expression is taken as the overall result. If none of the bool-conditions evaluate to true, the overall result is taken from the expression associated with the ELSE clause.

Example:

CASE

WHEN AlarmState = 4 THEN 'Unaccepted Alarm'

WHEN AlarmState = 3 THEN 'Cleared Alarm'

WHEN AlarmState = 2 THEN 'Accepted Alarm'

WHEN AlarmState = 1 THEN 'Disabled Alarm'

WHEN AlarmState = 0 THEN 'No Alarm'

ELSE 'Unknown Alarm State'

END


Disclaimer

Geo SCADA Expert 2020